export interface ProfileReq {
  user_id?: string;
  maijia_id?: number;
}

export interface ProfileRes {
  user_id?: string;
  user_name?: string;
  avatar?: string;
  token?: string;
  headimgurl?: string;
}

export interface LoginReq {
  account: string;
  password: string;
  id?: number; // 多账户选择时的账户ID
}

// 多账户选择项接口
export interface AccountOption {
  id: number;
  name: string;
  mobile: string;
  dangkou_name: string;
}

// 管理员信息接口
export interface AdminInfo {
  id: number;
  username: string;
  password: string;
  portrait: string;
  loginnum: number;
  last_login_ip: string;
  last_login_time: number;
  phone: string;
  real_name: string;
  status: number;
  groupid: number;
  supplier_id: number;
  token: string;
  app_token: string | null;
  app_status: number;
  app_isauth: number;
  app_pwds: string | null;
  pid: string | null;
  is_admin: string;
  addtime: number;
  outtime: number;
  huokuan_set: string | null;
  fujiafei_set: string | null;
  total_set: string | null;
  address: string;
  area: string;
}

// 单个用户信息接口
export interface UserInfo {
  id: number;
  merchant_id: number | null;
  name: string;
  mobile: string;
  password: string;
  status: number;
  token: string;
  addtime: number;
  last_login_time: number;
  loginout_time: number | null;
  last_hand_time: number | null;
  group_id: number;
  login_time: number;
  remark: string;
  admin_id: number;
  admin: AdminInfo;
  multiple_merchants?: number;
  multiple_merchants_info?: Array<{
    id: number;
    name: string;
    mobile: string;
    dangkou_name: string;
  }>;
  print?: {
    printer_name: string;
    printer_number: number;
    printer_spec: string;
    fujiafei: number;
    printer_type: number;
    shoukuan_link: string;
    is_auto_receipt: number;
    use_printer_name: string;
    use_printer_id: string;
    use_print_template: number;
    print_huozhu_chaifen: number;
    print_fenjian: number;
    speaker: null;
    keyboard_speaker: null;
    speaker_gender: null;
    speaker_speed: null;
    speaker_pitch: null;
    speaker_volume: null;
    base64: string;
    field: {
      header: Array<any>;
      header1: Array<any>;
      goods: Array<any>;
      settle: Array<any>;
      pay: Array<any>;
      other: Array<any>;
      printer: Array<any>;
    };
  };
}

export interface LoginByCodeReq {
  code: string;
}

// 微信多商户登录请求参数
export interface WxLoginReq {
  phone: string;
  id: number;
}

// 微信多商户登录响应
export interface WxLoginRes {
  code: number;
  msg: string;
  time: string;
  data: {
    token: string;
  };
}

export interface LoginByCodeRes {
  code: number;
  msg: string;
  time: string;
  data: {
    token?: string;
    info?: UserInfo | AccountOption[]; // 支持单账户和多账户
  } | AccountOption[]; // 直接返回多账户数组的情况
}

export interface getUserInfoReq {
  maijia_id: number;
}

export interface getUserInfoRes {
  code: number;
  msg: string;
  time: string;
  data: {
    headimgurl: string | null;
  };
}

// 用户信息
export interface UserInfoData {
  avatar: string;
  nickname: string;
  lv: number;
  money: string;
  coupon: string;
  mc: string;
  integral: number;
  mobile: string;
  encrypt: string;
  ct_status: number;
  ne_money: number;
}

// 订单数量信息
export interface OrderNumData {
  non_order: number;
  on_order: number;
  com_order: number;
}

// 支付信息
export interface PayData {
  paying: number;
  payed: number;
  purchase: number;
}

// 用户中心接口返回数据
export interface UserCenterRes {
  code: number;
  msg: string;
  time: string;
  data: {
    userinfo: UserInfoData;
    orderNum: OrderNumData;
    pay: PayData;
  };
}

// 用户中心接口请求参数
export interface UserCenterReq {
  // 一般这里不需要参数，只需要在请求头中携带token
}

// 通过token获取用户信息接口请求参数
export interface GetUserInfoByTokenReq {
  token: string;
}

// 通过token获取用户信息接口响应
export interface GetUserInfoByTokenRes {
  code: number;
  msg: string;
  time: string;
  data: UserInfo; // 返回用户信息，结构与UserInfo相同
}

// 登录响应接口 - 支持单账户和多账户
export interface LoginRes {
  code: number;
  msg: string;
  time: string;
  data: {
    token: string;
    info?: UserInfo | AccountOption[]; // 单账户时为UserInfo,多账户时为AccountOption数组
  };
}

// 收银员列表请求参数
export interface CashierListReq {
  limit: number;
  page: number;
}

// 收银员信息
export interface CashierItem {
  id: number;
  merchant_id: string | null;
  name: string;
  mobile: string;
  password: string;
  status: number;
  token: string;
  addtime: number;
  last_login_time: number;
  loginout_time: string | null;
  last_hand_time: string | null;
  group_id: number;
  login_time: number;
  remark: string;
  admin_id: number;
}

// 收银员列表响应
export interface CashierListRes {
  code: number;
  msg: string;
  time: string;
  data: {
    total: number;
    per_page: number;
    current_page: number;
    last_page: number;
    data: CashierItem[];
  };
}

// 添加收银员请求参数
export interface AddCashierReq {
  name: string;
  mobile: string;
  password: string;
  group_id: number;
}

// 添加收银员响应
export interface AddCashierRes {
  code: number;
  msg: string;
  time: string;
  data?: any;
}

// 编辑收银员请求参数
export interface EditCashierReq {
  name: string;
  mobile: string;
  password: string;
  group_id: number;
  id: number;
}

// 编辑收银员响应
export interface EditCashierRes {
  code: number;
  msg: string;
  time: string;
  data?: any;
}

// 删除收银员请求参数
export interface DelCashierReq {
  user_id: number;
}

// 删除收银员响应
export interface DelCashierRes {
  code: number;
  msg: string;
  time: string;
  data?: any;
}

// 收银员分组信息
export interface CashierGroup {
  id: number;
  name: string;
  admin_id: number;
  shouyin_id: number;
  time: string;
}

// 获取收银员分组响应
export interface CashierGroupRes {
  code: number;
  msg: string;
  time: string;
  data: CashierGroup[];
}

// 权限组信息
export interface RuleGroup {
  id: number;
  title: string;
  rules: string;
  status: number;
  create_time: number;
  update_time: number;
  admin_id: number;
}

// 获取权限组列表响应
export interface RuleGroupRes {
  code: number;
  msg: string;
  time: string;
  data: RuleGroup[];
}

// 添加权限组请求参数
export interface AddRuleGroupReq {
  title: string;
  rules: string[];
}

// 添加权限组响应
export interface AddRuleGroupRes {
  code: number;
  msg: string;
  time: string;
  data?: any;
}

// 编辑权限组请求参数
export interface EditRuleGroupReq {
  id: number;
  title: string;
  rules: string[];
}

// 编辑权限组响应
export interface EditRuleGroupRes {
  code: number;
  msg: string;
  time: string;
  data?: any;
}

// 删除权限组请求参数
export interface DelRuleGroupReq {
  id: number;
}

// 删除权限组响应
export interface DelRuleGroupRes {
  code: number;
  msg: string;
  time: string;
  data?: any;
}

// 获取规则详情响应
export interface RuleDetailRes {
  code: number;
  msg: string;
  time: string;
  data: {
    id: number;
    name: string;
    title: string;
    pid: number;
    create_time: number;
    sort: number;
    status: number;
    level: number;
    update_time: number;
    icon: string;
    path: string;
    img: string;
  }[];
}
